/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Comparator;
import java.util.Random;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * <p>Project: javaseapp - IntStream3
 * <p>Powered by webrx On 2021-08-23 08:35:46
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class IntStream3 {
    public static void main(String[] args) {
        IntStream is = IntStream.empty();
        is = IntStream.of(10, 20, 30, 40);
        is = IntStream.range(1, 5);
        is = IntStream.rangeClosed(1, 10);
        Random rand = new Random();
        is = IntStream.generate(() -> rand.nextInt(100) + 1).limit(8).skip(2);
        //升序
        //is.sorted().forEach(System.out::println);

        //降序
        Stream<Integer> si = is.boxed();
        //si.forEach(System.out::println);
        si.sorted(Comparator.reverseOrder()).forEach(System.out::println);

    }
}
